<!--!
This file is a part of MediaDrop (https://www.mediadrop.video),
Copyright 2009-2018 MediaDrop contributors
For the exact contribution history, see the git revision log.
The source code contained in this file is licensed under the GPLv3 or
(at your option) any later version.
See LICENSE.txt in the main project directory, for more information.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="../master.html" />
<head>
	<title>${podcast.title and _('Edit Podcast') + ': ' + podcast.title or _('New Podcast')}</title>
	<link href="${h.url_for('/admin/styles/forms.css')}" media="screen" rel="stylesheet" type="text/css" />
	<link href="${h.url_for('/admin/styles/uploader.css')}" media="screen" rel="stylesheet" type="text/css" />
	<link href="${h.url_for('/admin/styles/podcasts.css')}" media="screen" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="${h.url_for('/scripts/third-party/DynamicTextarea-0.92-yui-compressed.js')}"></script>
	<script src="${h.url_for('/scripts/third-party/squeezebox-1.1-rc4-yui-compressed.js')}" type="text/javascript" />
	<link href="${h.url_for('/admin/styles/squeezebox.css')}" media="screen" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="${h.url_for('/scripts/third-party/Fx.ProgressBar-yui-compressed.js')}"></script>
	<script type="text/javascript" src="${h.url_for('/scripts/third-party/Swiff.Uploader.js')}"></script>
	<script type="text/javascript" src="${h.url_for('/admin/scripts/forms.js')}"></script>
	<script type="text/javascript" src="${h.url_for('/admin/scripts/uploader.js')}"></script>
	<script type="text/javascript" src="${h.url_for('/admin/scripts/confirm.js')}" />
	<script type="text/javascript">
		MooTools.lang.set('en-US', 'FancyUpload', {
			errors: {
				httpStatus: '${_('Saving the file failed. Please try again').replace("'", "\\'")}',
				securityError: '${_('Security error occured (%(text)s)').replace("'", "\\'") % dict(text='{text}')}',
				ioError: '${_('Error caused a send or load operation to fail (%(text)s)').replace("'", "\\'") % dict(text='{text}')}'
			},
			validationErrors: {
				duplicate: '${_('File has already been added, duplicates are not allowed').replace("'", "\\'")}',
				sizeLimitMin: '${_('File is too small, the minimal file size is %(size)s').replace("'", "\\'") % dict(size='{fileSizeMin}')}',
				sizeLimitMax: '${_('File is too large, the maximum file size is %(size)s').replace("'", "\\'") % dict(size='{fileSizeMax}')}',
				fileListMax: '${_('File could not be added, amount of %(num)s files exceeded').replace("'", "\\'") % dict(num='{fileListMax}')}',
				fileListSizeMax: '${_('File is too big, overall filesize of %(size)s exceeded').replace("'", "\\'") % dict(size='{fileListSizeMax}')}'
			}
		});
		window.addEvent('domready', function(){
			var slug = new BoxForm.Slug('slug', {slugify: 'title', editText: '${_('Edit').replace("'", "\\'")}', hideText: '${_('Hide').replace("'", "\\'")}'});
			if (${int(podcast.id is not None)}) slug.detachSlugifier();
			$('feed_feed_url').addEvent('click', function(e){
				e.target.select();
			});

			var deleteConfirm = new DeleteConfirmMgr({
				header: '${_('Confirm Delete').replace("'", "\\'")}',
				msg: '${_('Are you sure you want to delete this?').replace("'", "\\'")}',
				confirmButtonText: '${_('Delete').replace("'", "\\'")}',
				cancelButtonText: '${_('Cancel').replace("'", "\\'")}'
			});
			$('delete').addEvent('click', deleteConfirm.openConfirmDialog.bind(deleteConfirm));

			var thumbUploader = new ThumbUploader({
				image: 'thumb-img',
				target: 'thumb',
				statusContainer: 'thumb-upload',
				fxProgressBar: {url: '${h.url_for('/admin/images/progressbar/progress.png')}'},
				uploadBtnText: '${_('Upload image').replace("'", "\\'")}',
				path: '${h.url_for('/scripts/third-party/Swiff.Uploader.swf')}',
				verbose: false // debug
			<py:if test="podcast.id is None">
				, onDisabledBrowse: function(){
					alert('You must first save this podcast before you can attach a thumbnail.');
				},
				onLoad: function(){
					this.setEnabled(false);
				}
			</py:if>
			});

			var desc = $('description');
			if (!desc.hasClass('tinymcearea')) {
				var descArea = new DynamicTextarea(desc, {minRows: 4});
			}
		});
	</script>
</head>
<body class="menu-podcasts-on">
	<div class="column66">
		<div class="box">
			<div class="box-head">
				<small py:if="podcast.created_on" class="box-head-sec">Uploaded: ${h.format_date(podcast.created_on)}</small>
				<h1>${podcast.title or _('New Podcast')}</h1>
			</div>
			${form(form_values, action=form_action)}
		</div>
	</div>
	<div class="column33">
		<div class="box">
			<div class="box-head">
				<div class="box-head-sec">
					<a href="${h.url_for(controller='/podcasts', action='view', slug=podcast.slug)}"
					   id="go-view-content" class="f-rgt"
					   title="View this podcast where it is published"
					   py:content="_('View')" />
				</div>
				<h1>Thumbnail</h1>
			</div>
			<div class="box-content center">
				<div class="thumb" py:with="thumb = h.thumb(podcast, 'm')">
					<img id="thumb-img" alt="Thumb"
					     src="${thumb.url}" width="${thumb.x}" height="${thumb.y}" />
				</div>
				<div class="center">
					<form py:replace="thumb_form(css_class='center', action=thumb_action)" />
				</div>
			</div>
			<div id="thumb-upload" class="upload-status">
				<div class="upload-file hidden" />
				<div class="upload-progress hidden">
					<img src="${h.url_for('/admin/images/progressbar/bar.png')}" width="238" height="12" />
				</div>
				<div class="box-error upload-error hidden" />
			</div>
		</div>
	</div>
</body>
</html>
